package com.hjrpc.babyyamall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.hjrpc.common.valid.ListValue;
import com.hjrpc.common.valid.group.Create;
import com.hjrpc.common.valid.group.Update;
import com.hjrpc.common.valid.group.UpdateStatus;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author hujian
 * @email 502361472@qq.com
 * @date 2021-08-07 12:54:21
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @Null(message = "新增时必须为null", groups = {Create.class})
    @NotNull(message = "修改时不能为null", groups = {Update.class, UpdateStatus.class})
    @Min(value = 1, groups = {Update.class, UpdateStatus.class})
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(groups = {Create.class, Update.class})
    @Length(groups = {Create.class, Update.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @URL(groups = {Create.class, Update.class})
    @NotBlank(groups = {Create.class, Update.class})
    private String logo;

    /**
     * 介绍
     */
    @Length(groups = {Create.class, Update.class})
    private String descript;

    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(groups = {Create.class, Update.class, UpdateStatus.class})
    @ListValue(values = {0, 1}, groups = {Create.class, Update.class, UpdateStatus.class})
    private Integer showStatus;

    /**
     * 检索首字母
     */
    @Pattern(regexp = "^[a-zA-Z]$", groups = {Create.class, Update.class})
    @NotBlank(groups = {Create.class, Update.class})
    private String firstLetter;

    /**
     * 排序
     */
    @Min(value = 0, groups = {Create.class, Update.class})
    @Max(value = 100, groups = {Create.class, Update.class})
    @NotNull(groups = {Create.class, Update.class})
    private Integer sort;

}
